home *** CD-ROM | disk | FTP | other *** search
- /*
- ** Apple Macintosh Developer Technical Support
- **
- ** FileCopy: A robust, general purpose file copy routine.
- **
- ** by Jim Luther, Apple Developer Technical Support Emeritus
- **
- ** File: FileCopy.h
- **
- ** Copyright © 1992-1995 Apple Computer, Inc.
- ** All rights reserved.
- **
- ** You may incorporate this sample code into your applications without
- ** restriction, though the sample code has been provided "AS IS" and the
- ** responsibility for its operation is 100% yours. However, what you are
- ** not permitted to do is to redistribute the source as "DSC Sample Code"
- ** after having made changes. If you're going to re-distribute the source,
- ** we require that you make it clear in the source that the code was
- ** descended from Apple Sample Code, but that you've made changes.
- */
-
- #ifndef __FILECOPY__
- #define __FILECOPY__
-
- #include <Types.h>
- #include <Files.h>
-
- #ifdef __cplusplus
- extern "C" {
- #endif
-
- /*****************************************************************************/
-
- pascal OSErr FileCopy(short srcVRefNum,
- long srcDirID,
- ConstStr255Param srcName,
- short dstVRefNum,
- long dstDirID,
- StringPtr dstPathname,
- StringPtr copyName,
- void *copyBufferPtr,
- long copyBufferSize,
- Boolean preflight);
- /* ¶ Duplicate a file and optionally rename it.
- The FileCopy function duplicates a file and optionally renames it.
- Since the PBHCopyFile routine is only available on some
- AFP server volumes under specific conditions, this routine
- either uses PBHCopyFile, or does all of the work PBHCopyFile
- does. The srcVRefNum, srcDirID and srcName are used to
- determine the location of the file to copy. The dstVRefNum
- dstDirID and dstPathname are used to determine the location of
- the destination directory. If copyName <> NIL, then it points
- to the name of the new file. If copyBufferPtr <> NIL, it
- points to a buffer of copyBufferSize that is used to copy
- the file's data. The larger the supplied buffer, the
- faster the copy. If copyBufferPtr = NIL, then this routine
- allocates a buffer in the application heap. If you pass a
- copy buffer to this routine, make its size a multiple of 512
- ($200) bytes for optimum performance.
-
- srcVRefNum input: Source volume specification.
- srcDirID input: Source directory ID.
- srcName input: Source file name.
- dstVRefNum input: Destination volume specification.
- dstDirID input: Destination directory ID.
- dstPathname input: Pointer to destination directory name, or
- nil when dstDirID specifies a directory.
- copyName input: Points to the new file name if the file is
- to be renamed or nil if the file isn't to
- be renamed.
- copyBufferPtr input: Points to a buffer of copyBufferSize that
- is used the i/o buffer for the copy or
- nil if you want FileCopy to allocate its
- own buffer in the application heap.
- copyBufferSize input: The size of the buffer pointed to
- by copyBufferPtr.
- preflight input: If true, FileCopy makes sure there are enough
- allocation blocks on the destination volume to
- hold both the data and resource forks before
- starting the copy.
-
- __________
-
- Also see: FSpFileCopy, DirectoryCopy, FSpDirectoryCopy
- */
-
- /*****************************************************************************/
-
- pascal OSErr FSpFileCopy(const FSSpec *srcSpec,
- const FSSpec *dstSpec,
- StringPtr copyName,
- void *copyBufferPtr,
- long copyBufferSize,
- Boolean preflight);
- /* ¶ Duplicate a file and optionally rename it.
- The FSpFileCopy function duplicates a file and optionally renames it.
- Since the PBHCopyFile routine is only available on some
- AFP server volumes under specific conditions, this routine
- either uses PBHCopyFile, or does all of the work PBHCopyFile
- does. The srcSpec is used to
- determine the location of the file to copy. The dstSpec is
- used to determine the location of the
- destination directory. If copyName <> NIL, then it points
- to the name of the new file. If copyBufferPtr <> NIL, it
- points to a buffer of copyBufferSize that is used to copy
- the file's data. The larger the supplied buffer, the
- faster the copy. If copyBufferPtr = NIL, then this routine
- allocates a buffer in the application heap. If you pass a
- copy buffer to this routine, make its size a multiple of 512
- ($200) bytes for optimum performance.
-
- srcSpec input: An FSSpec record specifying the source file.
- dstSpec input: An FSSpec record specifying the destination
- directory.
- copyName input: Points to the new file name if the file is
- to be renamed or nil if the file isn't to
- be renamed.
- copyBufferPtr input: Points to a buffer of copyBufferSize that
- is used the i/o buffer for the copy or
- nil if you want FileCopy to allocate its
- own buffer in the application heap.
- copyBufferSize input: The size of the buffer pointed to
- by copyBufferPtr.
- preflight input: If true, FSpFileCopy makes sure there are
- enough allocation blocks on the destination
- volume to hold both the data and resource forks
- before starting the copy.
-
- __________
-
- Also see: FileCopy, DirectoryCopy, FSpDirectoryCopy
- */
-
- /*****************************************************************************/
-
- #ifdef __cplusplus
- }
- #endif
-
- #endif /* __FILECOPY__ */
-